import { _decorator, AudioClip, AudioSource, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('AudioManager')
export class AudioManager extends Component {
	
    private static _instance:AudioManager;


    private _audioSource: AudioSource | null = null
    



	
    private _music: AudioClip | null = null
    


    public static  get instance() : AudioManager {
        return this._instance;
    }
    

    protected onLoad(): void {
        
        if (AudioManager._instance) {
            this.destroy();
            return;
        }
        AudioManager._instance = this;
        this._audioSource = this.getComponent(AudioSource)
        if (!this._audioSource) {
            this._audioSource = this.node.addComponent(AudioSource)
        }
        console.log(this._audioSource)
	}
    start() {
        
    }

    // play() {
    //     console.log("audio_manager:play: " + this._audioSource)
	// 	this._audioSource.play()
	// }

	update(deltaTime: number) {}
}


